package com.wn55.hrms.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wn55.hrms.entity.Dimission;
import com.wn55.hrms.mapper.DimissionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DimissionService {

    DimissionMapper dimissionMapper;

    @Autowired
    public void setDimissionMapper(DimissionMapper dimissionMapper){this.dimissionMapper = dimissionMapper;}


    public PageInfo<Dimission> initDimissionMenu(Integer now, Integer size, String name) {
        PageHelper.startPage(now,size);
        List<Dimission> list = dimissionMapper.selectByCondition(name);
        return new PageInfo<>(list);
    }

    public void add(Dimission dimission) {
        dimissionMapper.insert(dimission);
    }

    public void update(Dimission dimission) {
        dimissionMapper.updateByPrimaryKey(dimission);
    }

    public void delete(String id) {
        dimissionMapper.deleteByPrimaryKey(id);
    }
}
